package vn.com.demand.lux.model;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;

import org.apache.commons.dbutils.ResultSetHandler;

/**
 * @author Nguyen The Thinh
 */
public class SalesOrderBean implements ResultSetHandler{

	private String salesOrder;
	private String itemCode;
	private String itemName;

	public String getSalesOrder() {
		return salesOrder;
	}

	public void setSalesOrder(String salesOrder) {
		this.salesOrder = salesOrder;
	}

	public String getItemCode() {
		return itemCode;
	}

	public void setItemCode(String itemCode) {
		this.itemCode = itemCode;
	}

	public String getItemName() {
		return itemName;
	}

	public void setItemName(String itemName) {
		this.itemName = itemName;
	}

	public Object handle(ResultSet rs) throws SQLException {
		ArrayList<SalesOrderBean> list = new ArrayList<SalesOrderBean>();
		while(rs.next()) {
			SalesOrderBean bean = new SalesOrderBean();
			bean.setSalesOrder(rs.getString("salesorder"));
			bean.setItemCode(rs.getString("itemcode"));
			bean.setItemName(rs.getString("itemname"));
			list.add(bean);
		}
		return list.toArray(new SalesOrderBean[0]);
	}

}
